<template>
	<view class="mine">
		<uni-nav-bar :fixed="true" :border="false" backgroundColor="#f9f2ea" :statusBar="true" leftText="我的"
			@clickLeft="goBack"></uni-nav-bar>
		<!-- <image class="head-bg" src="../../static/swiper.png" mode=""></image> -->
		<view class="head-mark">

		</view>

		<view class="header" >

			<image @click="toLogin" class="head" :src="userData.head_pic" mode=""></image>
			<view class="type flex-center">
				<view class="">
					{{userData.nickname ? userData.nickname : "微信用户"}}
				</view>
				<!-- <image class="img" src="../../static/vip1.png" mode=""></image> -->
			</view>

			<view class="flex-center content">
				<navigator url="collect" hover-class="none">
					<view class="box">
						<image class="img" src="../../static/mine_like.png" mode=""></image>
						<view class="name">
							喜欢
						</view>
						<view class="number">
							{{userData.collects}}
						</view>
					</view>
				</navigator>
				<!-- <navigator url="follow" hover-class="none">
					<view class="box">
						<image class="img" src="../../static/mine_follow.png" mode=""></image>
						<view class="name">
							关注
						</view>
						<view class="number">
							70
						</view>
					</view>
				</navigator> -->
				<navigator url="order" hover-class="none">
					<view class="box">
						<image class="img" src="../../static/mine_order.png" mode=""></image>
						<view class="name">
							订单
						</view>
						<view class="number">
							{{userData.orders}}
						</view>
					</view>
				</navigator>
			</view>
		</view>
		<view class="list">
			<navigator url="gameCollect" hover-class="none">
				<view class="item flex-between">
					<view class="flex">
						<image class="img" src="../../static/member.png" mode=""></image>
						<view class="name">
							我的收藏品
						</view>
					</view>
					<image class="more" src="../../static/art_more.png" mode=""></image>
				</view>
			</navigator>
			<navigator url="createArtwork" hover-class="none">
				<view class="item flex-between">
					<view class="flex">
						<image class="img" src="../../static/publish.png" mode=""></image>
						<view class="name">
							开始创作
						</view>
					</view>
					<image class="more" src="../../static/art_more.png" mode=""></image>
				</view>
			</navigator>
			<navigator url="../others/coupon" hover-class="none">
				<view class="item flex-between">
					<view class="flex">
						<image class="img" src="../../static/ask.png" mode=""></image>
						<view class="name">
							优惠券
						</view>
					</view>
					<image class="more" src="../../static/art_more.png" mode=""></image>
				</view>
			</navigator>
			<button open-type="contact" class="item btn flex-between">
				<view class="flex">
					<image class="img" src="../../static/customer_service.png" mode=""></image>
					<view class="name">
						联系客服
					</view>
				</view>
				<image class="more" src="../../static/art_more.png" mode=""></image>
			</button>
			<navigator url="../shoppingCart/myAddress?num=0" hover-class="none">
				<view class="item flex-between">
					<view class="flex">
						<image class="img" src="../../static/location.png" mode=""></image>
						<view class="name">
							修改地址
						</view>
					</view>
					<image class="more" src="../../static/art_more.png" mode=""></image>
				</view>
			</navigator>
			<navigator url="receipt" hover-class="none">
				<view class="item flex-between">
					<view class="flex">
						<image class="img" src="../../static/personal_data.png" mode=""></image>
						<view class="name">
							发票
						</view>
					</view>
					<image class="more" src="../../static/art_more.png" mode=""></image>
				</view>
			</navigator>
			<!-- <view class="item flex-between">
				<view class="flex">
					<image class="img" src="../../static/ask.png" mode=""></image>
					<view class="name">
						艺术家申请
					</view>
				</view>
				<image class="more" src="../../static/art_more.png" mode=""></image>
			</view> -->
			<!-- <view class="item flex-between">
					<view class="flex">
						<image class="img" src="../../static/set.png" mode=""></image>
						<view class="name">
							设置
						</view>
					</view>
					<image class="more" src="../../static/art_more.png" mode=""></image>
				</view> -->
		</view>
		<FootBar></FootBar>
	</view>
</template>

<script>
	import {
		userInfo
	} from "@/api/public.js"
	import FootBar from '@/components/footbar.vue'
	export default {
		data() {
			return {
				userData: {
					nickname: "",
					head_pic: "",
				},

			}
		},
		onShow() {
			this.getUserInfo();
			console.log(this.userData.nickname)
		},
		methods: {
			goBack() {
				uni.navigateBack();
			},
			getUserInfo() {
				userInfo().then(res => {
					// this.unLogin = false;
					this.userData = res.reData.data;
					console.log(this.userData)
					// if (!this.userData.nickname) {

					// }
					// uni.setStorageSync("userData", JSON.stringify(this.userData));
				})
			},
			toLogin() {
				uni.navigateTo({
					url: "/pages/index/userInfo"
				})

			},
		},
		components: {
			FootBar
		}
	}
</script>

<style lang="scss" scoped>
	.mine {
		padding: 0 30rpx 0;
	}

	.head-bg {
		width: 100%;
		position: absolute;
		top: 0;
		left: 0;
		z-index: -1;
	}

	.head-mark {
		height: 100rpx;
	}

	.header {
		box-sizing: border-box;
		position: relative;
		width: 100%;
		height: 400rpx;
		border-radius: 10rpx;
		background: rgba(255, 250, 245, 1);
		padding-top: 100rpx;
		margin-bottom: 20rpx;
		box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.07);

		.head {
			position: absolute;
			width: 150rpx;
			height: 150rpx;
			border: 2rpx solid rgba(255, 250, 245, 1);
			border-radius: 75rpx;
			top: -75rpx;
			left: 50%;
			margin-left: -75rpx;
			z-index: 10;
		}

		.type {
			font-size: 30rpx;
			line-height: 30rpx;
			color: #333;
			margin: 20rpx 0 30rpx 0;

			.img {
				width: 30rpx;
				height: 30rpx;
				margin-left: 10rpx;
			}
		}

		.star {
			margin-bottom: 10rpx;

			.img {
				width: 32rpx;
				height: 32rpx;
				margin-right: 20rpx;

				&:last-child {
					margin-right: 0;
				}
			}
		}

		.id {
			color: #999;
			font-size: 20rpx;
			line-height: 20rpx;
			text-align: center;
			margin-bottom: 20rpx;
		}

		.content {
			.box {
				margin: 0 80rpx;

				.img {
					display: block;
					width: 60rpx;
					height: 60rpx;
					margin: 0 auto 20rpx;
				}

				.name {
					font-size: 26rpx;
					line-height: 26rpx;
					color: #333;
					text-align: center;
					margin-bottom: 20rpx;
				}

				.number {
					font-size: 24rpx;
					line-height: 24rpx;
					color: #f5b225;
					text-align: center;
				}
			}
		}
	}

	.list {
		padding: 0 30rpx;
		background: rgba(255, 250, 245, 1);
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.07);

		.item {
			padding: 30rpx 0;
			border-bottom: 2rpx solid #f2f2f2;
			display: flex;
			align-items: center;

			&.btn {
				&::after {
					border: none;
				}

				background: rgba(255, 250, 245, 1);
				margin: 0;
				border: none;
				border-bottom: 2rpx solid #f2f2f2;
			}

			.img {
				width: 40rpx;
				height: 40rpx;
				margin-right: 20rpx;
			}

			.name {
				font-size: 26rpx;
				line-height: 40rpx;
				color: #333;
				// font-weight: 700;
			}

			.more {
				width: 20rpx;
				height: 30rpx;
			}
		}
	}
</style>
